package com.example.demo.mapper;

import java.util.List;

import com.example.demo.entity.User;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

public interface UserMapper {
    /**
     * 查看用户列表
     * 
     * @return List<User>
     */
    @Select("select * from user as u left join user_info as uinfo on u.id=uinfo.user_id ")
    @Results({
            @Result(property = "userInfo", column = "user_id", one = @One(select = "com.example.demo.mapper.UserInfoMapper.getUserInfoListByUserId", fetchType = FetchType.EAGER)) })
    List<User> getUserList();

    /**
     * 添加一个用户
     * 
     * @return User
     */
    void addUser(User user);

    /**
     * 修改用户
     * 
     * @return User
     */
    void updateUser(User user);

}
